import threading
import time
# 定义一个函数供线程执行
# def print_numbers():
#     for i in range(1, 10):
#         print(f"Thread {threading.current_thread().name}: {i}")
#         # 暂停一会儿线程
#         time.sleep(0.5)
#
# # 创建线程
# thread1 = threading.Thread(target=print_numbers, name="Thread-1")
# thread2 = threading.Thread(target=print_numbers, name="Thread-2")
#
# # 启动线程
# thread1.start()
# thread2.start()
#
# # 等待线程结束
# thread1.join()
# thread2.join()
#
# print("Both threads have finished execution.")



def num_add(num1,num2):
    for i in range(5):
        num1 = num1+1
        num2+=1
        print(num1+ num2)
        time.sleep(2)

def num_mul(num1,num2):
    for i in range(5):
        num1+=1
        num2+=1
        print(num1* num2)
        time.sleep(1)

# 创建线程
thread1 = threading.Thread(target=num_add, name="Thread-1",args=(1,2))
thread2 = threading.Thread(target=num_mul, name="Thread-2",args=(3,4))


# 启动线程
thread1.start()
thread2.start()

# 等待线程结束
thread1.join()
thread2.join()